/**
 *
 */
package jp.seraph.same.controller;

import jp.seraph.jsade.model.JointIdentifierContainer;
import jp.seraph.same.model.MotionElementModel;

/**
 *
 */
public class DefaultMotionElementController implements MotionElementController {
    public DefaultMotionElementController(MotionElementModel aModel, MotionSessionController aParentController, JointIdentifierContainer aIdContainer) {
        mModel = aModel;
        mParentController = aParentController;
        mIdContainer = aIdContainer;
    }

    private MotionElementModel mModel;
    private MotionSessionController mParentController;
    private JointIdentifierContainer mIdContainer;

    /**
     * @see jp.seraph.same.controller.MotionElementController#deselectJoint(jp.seraph.jsade.model.JointIdentifier)
     */
    public void deselectJoint(String aId) throws IllegalArgumentException {
        mModel.deselectJoint(mIdContainer.getIdentifier(aId));
    }

    /**
     * @see jp.seraph.same.controller.MotionElementController#selectJoint(jp.seraph.jsade.model.JointIdentifier)
     */
    public void selectJoint(String aId) throws IllegalArgumentException {
        mModel.selectJoint(mIdContainer.getIdentifier(aId));
    }

    /**
     * @see jp.seraph.same.controller.MotionElementController#setBasePose(java.lang.String)
     */
    public void setBasePose(String aPoseName) throws IllegalArgumentException {
        mModel.setBasePose(aPoseName);
    }

    /**
     * @see jp.seraph.same.controller.MotionElementController#setStartTiming(int)
     */
    public void setStartTiming(int aTiming) throws IllegalArgumentException {
        mModel.setTiming(aTiming);
    }

    /**
     *
     * @see jp.seraph.same.controller.MotionElementController#setConditionElementName(java.lang.String)
     */
    public void setConditionElementName(String aElementName) throws IllegalArgumentException {
        mModel.setConditionElementName(aElementName);
    }

    /**
     *
     * @see jp.seraph.same.controller.MotionElementController#rename(java.lang.String)
     */
    public void rename(String aElementName) {
        mParentController.renameElement(mModel.getName(), aElementName);
    }

    public void delete() {
        mParentController.removeElement(mModel);
    }
}
